<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>流程管理</title>
    <#include '../include/common.html'/>
    <script type="text/javascript" src="<@s.url '/resources/process/js/defintion.js'/>"></script>
</head>
<body>
<div class="layui-btn-group">
    <button class="layui-btn" onclick="showAddWindow()" title="添加"><i class="layui-icon">&#xe654;</i>添加</button>
    <button class="layui-btn layui-btn-normal" onclick="javascript:location.reload();" title="刷新"><i class="layui-icon">&#x1002;</i>刷新</button>
</div>
<br>
<table class="layui-table">
    <thead>
    <tr>
        <th>流程定义ID</th>
        <th>分类</th>
        <th>名称</th>
        <th>流程定义Key</th>
        <th>说明</th>
        <th>版本</th>
        <th>资源文件名</th>
        <th>部署ID</th>
        <th>流程图</th>
        <th>状态</th>
        <th width="120px">操作</th>
    </tr>
    </thead>
    <tbody>
    <#list defintions as p>
    <tr>
        <td>${p.id!}</td>
        <td>${p.category!}</td>
        <td>${p.name!}</td>
        <td>${p.key!}</td>
        <td>${p.description!}</td>
        <td>${p.version!}</td>
        <td>${p.resourceName!}</td>
        <td>${p.deploymentId!}</td>
        <td>${p.diagramResourceName!}</td>
        <td>${p.suspended?string("挂起","激活")}</td>
        <td>
            <div class="layui-btn-group">
                <button class="layui-btn layui-btn-mini" onclick="showGraph('${p.id!}')">流程图</button>
                <a href="defintion/viewXml.htm?processDefinitionId=${p.id!}" target="_blank" class="layui-btn layui-btn-mini">Xml</a>
                <button class="layui-btn layui-btn-mini layui-btn-warm" onclick="showUpdateWindow('${p.id}')">修改</button>
                <button class="layui-btn layui-btn-mini layui-btn-danger" onclick="del('${p.deploymentId}',false)">删除</button>
                <button class="layui-btn layui-btn-mini layui-btn-danger" onclick="del('${p.deploymentId}',true)">删除(含历史)</button>
                <#if p.suspended>
                    <button class="layui-btn layui-btn-mini" onclick="suspendOrActivate('${p.id}','activate')">激活</button>
                    <#else>
                        <button class="layui-btn layui-btn-mini" onclick="suspendOrActivate('${p.id}','suspend')">挂起</button>
                </#if>
                <button class="layui-btn layui-btn-mini" onclick="start('${p.key}','${p.id!}')">发起</button>
            </div>
        </td>
    </tr>
    </#list>
    </tbody>
</table>

<!--弹出窗表单 start-->
<!--添加表单-->
<form id="addForm" action="add.do"  class="layui-form window-form">
    <div class="layui-form-item">
        <label class="layui-form-label">名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" required  lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">Xml文本</li>
            <li>Zip文件</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item layui-form-text">
                    <div class="layui-input-block">
                        <textarea rows="15" name="xml" placeholder="请输入内容xml" class="layui-textarea"></textarea>
                    </div>
                </div>
            </div>
            <div class="layui-tab-item">
                <div class="layui-form-item layui-form-text">
                    <div class="layui-input-block">
                        <input type="file" name="zipFile" placeholder="Zip文件" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
<!--修改表单-->
<form id="updateForm" action="update.do"  class="layui-form window-form">
    <div class="layui-form-item">
        <label class="layui-form-label">流程定义ID</label>
        <div class="layui-input-block">
            <input type="text" name="processDefinitionId" readonly  lay-verify="required" placeholder="流程定义ID" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">Xml</label>
        <div class="layui-input-block">
            <textarea rows="15" name="xml" placeholder="请输入内容Xml" lay-verify="required" class="layui-textarea"></textarea>
        </div>
    </div>
</form>
<!--弹出窗表单 end-->
</body>
</html>